import { ObservablePromiseModel } from 'bggood-store-utils';
const StatePlugin={
    install:function(Vue,options){
        options=options||{};
        options.obStateType=options.obStateType||ObservablePromiseModel;
        Vue.prototype.ObservableState=function(state){
            if(state instanceof options.obStateType){
                let objState = {
                    isOnLine: state.isOnLine,
                    isPending: state.isPending,
                    isRejected: state.isRejected,
                    isResolved: state.isResolved,
                    isServerError: state.isServerError,
                    isTimeout: state.isTimeout,
                    error:state.data&&!state.data.success?state.data.message:''
                  };
                  return objState;
            }
        }
    }
}
export default StatePlugin